Just Do It UserScript
original src
使う
code:js
import '/api/code/villagepump/Just_Do_It_UserScript/script.js';
意外と面白いなこれtakker.iconerniogi.icon増井俊之.icon
背景を透過して出てくるのか
wwwyosider.icon
数分間書き込みしていないと自動で励ましてくれるようにすると面白そうだけどうざそう
プレゼンモードでも動く 増井俊之.icon
授業で使ってやろうか!
使ってみた
ウケなかった
w
2021-07-02
11:38:25 UserCSSの設定を不要にした
screenshots
https://gyazo.com/936e1fc5cff9c475f6cec452bd2ce71f
code:script.js
function removeVideo() {
document.querySelector('.shia-do-it')?.remove?.();
}
function addVideo() {
removeVideo();
const shiaDoIt = document.createElement('div');
shiaDoIt.classList.add('shia-do-it');
shiaDoIt.attachShadow({mode: 'open'});
const container = document.createElement('div');
container.classList.add('container');
const video = document.createElement('video');
video.width = 960;
video.height = 540;
video.name = 'media';
container.append(video);
const style = document.createElement('style');
style.textContent = `
:host {
position: fixed;
bottom: 0;
z-index: 99999;
right: 0;
pointer-events: none;
}
.container {
width: 720px;
overflow: hidden;
display: block;
height: 535px;
}
.container video {
margin-top: -5px;
max-width: none;
padding: 0;
visibility: hidden;
}
`;
shiaDoIt.shadowRoot.append(style);
shiaDoIt.shadowRoot.append(container);
document.body.append(shiaDoIt);
video.src = choice([
]);
video.onended = function () {
removeVideo();
};
video.addEventListener('loadeddata', function () {
video.style.visibility = 'visible';
video.play();
}, false);
video.onerror = function () {
alert('ooops... Shia had a problem. try on another tab');
removeVideo();
};
video.load();
}
scrapbox.PageMenu.addMenu({
title: 'Just Do It',
onClick: () => addVideo(),
});
Chrome Betaだといちいち字幕出るの草]